home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 2 / Geek_Gadgets_2_2352.bin / lists / ade-gcc.archive.9602.gz / ade-gcc.archive.9602 / 000054_owner-ade-gcc_Wed Feb 14 06:28:17 1996.msg < prev    next >
Internet Message Format  |  1996-02-28  |  3KB

  1. Return-Path: <owner-ade-gcc>
  2. Received: by fishpond (Smail3.1.29.1 #57)
  3.     id m0tmfNK-000gYKa; Wed, 14 Feb 96 06:27 EST
  4. Sender: owner-ade-gcc
  5. Received: from ernie.icslab.agh.edu.pl by fishpond with smtp
  6.     (Smail3.1.29.1 #57) id m0tmfMS-000gXUC; Wed, 14 Feb 96 06:27 EST
  7. Received: (from kiskra@localhost) by ernie.icslab.agh.edu.pl (8.6.12/8.6.12) id MAA13865; Wed, 14 Feb 1996 12:27:25 +0100
  8. Date: Wed, 14 Feb 1996 12:27:25 +0100 (MET)
  9. From: Kamil Iskra <kiskra@ernie.icslab.agh.edu.pl>
  10. To: ADE GCC List <ade-gcc@amigalib.com>
  11. cc: Amiga GCC List <amiga-gcc-port@nic.funet.fi>
  12. Subject: Passing arguments in registers - first attempt.
  13. Message-ID: <Pine.SUN.3.91.960214114852.12545A-100000@ernie>
  14. MIME-Version: 1.0
  15. Content-Type: TEXT/PLAIN; charset=US-ASCII
  16. Sender: owner-ade-gcc@amigalib.com
  17. Precedence: bulk
  18.  
  19.  
  20. I managed to implement passing arguments in registers using GCC 2.7.0. It
  21. turned out to be very easy - GCC has full support for this. 
  22.  
  23. As of now, it works like this: 
  24.  
  25. By default GCC passes arguments on stack. 
  26.  
  27. If you specify "-mregparm" argument, GCC passes two first integer
  28. arguments in d0/d1 and two first pointers in a0/a1. 
  29.  
  30. Currently this is not very useful, since IXEmul and Libnix do not support
  31. this way of passing arguments. That's why I won't include patch in this
  32. posting - it's too preliminary (however, patch is available on my WWW page
  33. for those of you, who would like to see how it works. Pre-compiled cc1 is
  34. available, as well). 
  35.  
  36. I made a few simple tests and it seems that with optimisation turned off
  37. GCC produces very poor code for passing arguments in registers - it
  38. basically copies arguments from registers to stack on function entry.
  39. However, with optimisation turned on, code quality improves. 
  40.  
  41. I think that this posting should be the beginning of serious discussion
  42. about details of passing arguments in registers. 
  43.  
  44. I think that the most important things that should be addressed are: 
  45.  
  46. 1. How to distinguish register calls from stack calls (i.e. how linker
  47. should distinguish them)? 
  48.  
  49. 2.a. What should be the exact way of passing arguments in registers? 
  50.  
  51. 2.b. Like I did it, ie. two first integers in d0/d1, two first pointers in
  52. a0/a1, rest on stack? 
  53.  
  54. 2.c. Maybe we should use fp0/fp1 for floating point arguments? 
  55.  
  56. 2.d. Maybe there should be a default setting, which user can override by
  57. specifieng "-mregparm=<number>", where number is (for example) amount of
  58. register to use for each group of parameters (ie. 2 by default). 
  59.  
  60. 3. How should library calls be made? Should there be two entries for each
  61. function in every library? But this will result in worse code for stack
  62. calls than currently. And how to implement it in IXEmul? 
  63.  
  64. 4. I think that SAS/C compatible __stdargs and __regargs keywords should
  65. be implemented. If the latter one was specified as GCC attribute, it would
  66. be possible to provide <number> argument (see above), like this: 
  67.  
  68. void func() __attribute__ ((regargs(3)));
  69.  
  70. Have I forgotten about something? 
  71.  
  72. / Kamil Iskra - AMIGA 1200, 68030 50MHz, HDD 850 MB, 10 MB RAM \
  73. | iskra@student.uci.agh.edu.pl  kiskra@ernie.icslab.agh.edu.pl |
  74. | http://student.uci.agh.edu.pl/~iskra                         |
  75. \ PGP public key available via Finger or WWW                   /